From de0458eddc8c3154618c54ba0a04e785d041f91e Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Tue, 14 Nov 2023 07:36:58 -0700 Subject: [PATCH] use uniform header guards in jeeps. (#1216) and delete an obsolete prototype. rename jgpsutil.cc now that it doesn't conflict with a format. --- CMakeLists.txt | 2 +- jeeps/garminusb.h | 5 +++++ jeeps/gps.h | 6 +++--- jeeps/gpsapp.h | 6 +++--- jeeps/gpscom.h | 6 +++--- jeeps/gpsdatum.h | 6 +++--- jeeps/gpsdevice.h | 6 +++--- jeeps/gpsfmt.h | 6 +++--- jeeps/gpsmath.h | 6 +++--- jeeps/gpsmem.h | 6 +++--- jeeps/gpsport.h | 8 ++++++++ jeeps/gpsproj.h | 6 +++--- jeeps/gpsprot.h | 12 +++++------- jeeps/gpsread.h | 6 +++--- jeeps/gpsrqst.h | 6 +++--- jeeps/gpssend.h | 6 +++--- jeeps/gpsserial.h | 6 +++--- jeeps/gpsusbcommon.h | 4 ++++ jeeps/gpsusbint.h | 6 +++++- jeeps/{jgpsutil.cc => gpsutil.cc} | 0 jeeps/gpsutil.h | 6 +++--- 21 files changed, 70 insertions(+), 51 deletions(-) rename jeeps/{jgpsutil.cc => gpsutil.cc} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index fcbb1dc20..c664f0ed8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -153,7 +153,7 @@ set(JEEPS jeeps/gpsusbcommon.cc jeeps/gpsusbread.cc jeeps/gpsusbsend.cc - jeeps/jgpsutil.cc + jeeps/gpsutil.cc ) # SUPPORT diff --git a/jeeps/garminusb.h b/jeeps/garminusb.h index 5e968d655..41e9a9447 100644 --- a/jeeps/garminusb.h +++ b/jeeps/garminusb.h @@ -18,6 +18,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#ifndef JEEPS_GARMINUSB_H_INCLUDED_ +#define JEEPS_GARMINUSB_H_INCLUDED_ + #include #include "jeeps/gpsdevice.h" @@ -68,3 +71,5 @@ int gusb_close(gpsdevh* dh, bool exit_lib = true); #define GUSB_SESSION_START 5 /* We request units attention */ #define GUSB_SESSION_ACK 6 /* Unit responds that we have its attention */ #define GUSB_REQUEST_BULK 2 /* Unit requests we read from bulk pipe */ + +#endif // JEEPS_GARMINUSB_H_INCLUDED_ diff --git a/jeeps/gps.h b/jeeps/gps.h index f9e9f5484..a3701a998 100644 --- a/jeeps/gps.h +++ b/jeeps/gps.h @@ -1,5 +1,5 @@ -#ifndef gps_h -#define gps_h +#ifndef JEEPS_GPS_H_INCLUDED_ +#define JEEPS_GPS_H_INCLUDED_ #include "defs.h" #include "jeeps/gpsport.h" @@ -265,4 +265,4 @@ extern const char* gps_aviation_sym[]; extern const char* gps_16_sym[]; -#endif +#endif // JEEPS_GPS_H_INCLUDED_ diff --git a/jeeps/gpsapp.h b/jeeps/gpsapp.h index ee03d78de..12b33a211 100644 --- a/jeeps/gpsapp.h +++ b/jeeps/gpsapp.h @@ -1,5 +1,5 @@ -#ifndef gpsapp_h -#define gpsapp_h +#ifndef JEEPS_GPSAPP_H_INCLUDED_ +#define JEEPS_GPSAPP_H_INCLUDED_ #include "jeeps/gps.h" @@ -112,4 +112,4 @@ void GPS_Prepare_Track_For_Device(GPS_PTrack** trk, int32* n); int32 GPS_Set_Baud_Rate(const char* port, int br); -#endif +#endif // JEEPS_GPSAPP_H_INCLUDED_ diff --git a/jeeps/gpscom.h b/jeeps/gpscom.h index 53ece39b7..c8cc25806 100644 --- a/jeeps/gpscom.h +++ b/jeeps/gpscom.h @@ -1,5 +1,5 @@ -#ifndef gpscom_h -#define gpscom_h +#ifndef JEEPS_GPSCOM_H_INCLUDED_ +#define JEEPS_GPSCOM_H_INCLUDED_ #include "jeeps/gps.h" @@ -44,4 +44,4 @@ int32 GPS_Command_Get_Fitness_User_Profile(const char* port, void** lap, int (*cb)(int, GPS_SWay**)); int32 GPS_Command_Get_Workout_Limits(const char* port, void** lap, int (*cb)(int, GPS_SWay**)); int32 GPS_Command_Get_Course_Limits(const char* port, void** lap, int (*cb)(int, GPS_SWay**)); -#endif +#endif // JEEPS_GPSCOM_H_INCLUDED_ diff --git a/jeeps/gpsdatum.h b/jeeps/gpsdatum.h index c59f7977e..4444797dd 100644 --- a/jeeps/gpsdatum.h +++ b/jeeps/gpsdatum.h @@ -1,5 +1,5 @@ -#ifndef gpsdatum_h -#define gpsdatum_h +#ifndef JEEPS_GPSDATUM_H_INCLUDED_ +#define JEEPS_GPSDATUM_H_INCLUDED_ @@ -234,4 +234,4 @@ -#endif +#endif // JEEPS_GPSDATUM_H_INCLUDED_ diff --git a/jeeps/gpsdevice.h b/jeeps/gpsdevice.h index f893adf27..5abf56b0a 100644 --- a/jeeps/gpsdevice.h +++ b/jeeps/gpsdevice.h @@ -19,8 +19,8 @@ */ -#ifndef gpsdevice_h -#define gpsdevice_h +#ifndef JEEPS_GPSDEVICE_H_INCLUDED_ +#define JEEPS_GPSDEVICE_H_INCLUDED_ typedef struct gpsdevh gpsdevh; @@ -60,4 +60,4 @@ gps_device_op12 Write_Packet; } gps_device_ops; -#endif /* gpsdevice_h */ +#endif /* JEEPS_GPSDEVICE_H_INCLUDED_ */ diff --git a/jeeps/gpsfmt.h b/jeeps/gpsfmt.h index cbaad086d..3cf101690 100644 --- a/jeeps/gpsfmt.h +++ b/jeeps/gpsfmt.h @@ -1,5 +1,5 @@ -#ifndef gpsfmt_h -#define gpsfmt_h +#ifndef JEEPS_GPSFMT_H_INCLUDED_ +#define JEEPS_GPSFMT_H_INCLUDED_ #include "jeeps/gps.h" @@ -15,4 +15,4 @@ int32 GPS_Fmt_Print_Proximity(GPS_PWay* way, int32 n, FILE* outf); int32 GPS_Fmt_Print_Route(GPS_PWay* way, int32 n, FILE* outf); -#endif +#endif // JEEPS_GPSFMT_H_INCLUDED_ diff --git a/jeeps/gpsmath.h b/jeeps/gpsmath.h index 36d78436d..fa35c1ce0 100644 --- a/jeeps/gpsmath.h +++ b/jeeps/gpsmath.h @@ -1,5 +1,5 @@ -#ifndef gpsmath_h -#define gpsmath_h +#ifndef JEEPS_GPSMATH_H_INCLUDED_ +#define JEEPS_GPSMATH_H_INCLUDED_ #include "jeeps/gpsport.h" @@ -145,4 +145,4 @@ int32 GPS_Lookup_Datum_Index(const QString& n); const char* GPS_Math_Get_Datum_Name(int datum_index); -#endif +#endif // JEEPS_GPSMATH_H_INCLUDED_ diff --git a/jeeps/gpsmem.h b/jeeps/gpsmem.h index 5d29231e1..01038d9fa 100644 --- a/jeeps/gpsmem.h +++ b/jeeps/gpsmem.h @@ -1,5 +1,5 @@ -#ifndef gpsmem_h -#define gpsmem_h +#ifndef JEEPS_GPSMEM_H_INCLUDED_ +#define JEEPS_GPSMEM_H_INCLUDED_ #include "jeeps/gps.h" @@ -20,4 +20,4 @@ GPS_PCourse_Point GPS_Course_Point_New(); void GPS_Course_Point_Del(GPS_PCourse_Point* thys); -#endif +#endif // JEEPS_GPSMEM_H_INCLUDED_ diff --git a/jeeps/gpsport.h b/jeeps/gpsport.h index 3fac996ee..3646a3e67 100644 --- a/jeeps/gpsport.h +++ b/jeeps/gpsport.h @@ -7,9 +7,17 @@ * defs.h includes gbtypes.h before this file, just use that. */ +#ifndef JEEPS_GPSPORT_H_INCLUDED_ +#define JEEPS_GPSPORT_H_INCLUDED_ + +#include + + typedef unsigned char UC; typedef uint16_t US; typedef uint16_t uint16; typedef int16_t int16; typedef uint32_t uint32; typedef int32_t int32; + +#endif // JEEPS_GPSPORT_H_INCLUDED_ diff --git a/jeeps/gpsproj.h b/jeeps/gpsproj.h index f76814560..cbdca53df 100644 --- a/jeeps/gpsproj.h +++ b/jeeps/gpsproj.h @@ -1,5 +1,5 @@ -#ifndef gpsproj_h -#define gpsproj_h +#ifndef JEEPS_GPSPROJ_H_INCLUDED_ +#define JEEPS_GPSPROJ_H_INCLUDED_ #include "jeeps/gps.h" @@ -145,4 +145,4 @@ double* lambda, double phi0, double lambda0, double E0, double N0, double a, double b); -#endif +#endif // JEEPS_GPSPROJ_H_INCLUDED_ diff --git a/jeeps/gpsprot.h b/jeeps/gpsprot.h index e16600fdf..5a2a3cc6c 100644 --- a/jeeps/gpsprot.h +++ b/jeeps/gpsprot.h @@ -1,5 +1,5 @@ -#ifndef gpsprotocols_h -#define gpsprotocols_h +#ifndef JEEPS_GPSPROT_H_INCLUDED_ +#define JEEPS_GPSPROT_H_INCLUDED_ #ifndef COMMON #define COMMON extern @@ -90,8 +90,7 @@ US Cmnd_Transfer_Course_Points; US Cmnd_Transfer_Course_Tracks; US Cmnd_Transfer_Course_Limits; - } - ; + }; @@ -365,8 +364,7 @@ int32 prxd; int32 alma; int32 almd; - } - ; + }; US GPS_Protocol_Version_Change(US id, US version); COMMON int32 GPS_Protocol_Table_Set(US id); @@ -374,4 +372,4 @@ void GPS_Unknown_Protocol_Print(); -#endif +#endif // JEEPS_GPSPROT_H_INCLUDED_ diff --git a/jeeps/gpsread.h b/jeeps/gpsread.h index d8461ac22..6bee1e7ab 100644 --- a/jeeps/gpsread.h +++ b/jeeps/gpsread.h @@ -1,5 +1,5 @@ -#ifndef gpsread_h -#define gpsread_h +#ifndef JEEPS_GPSREAD_H_INCLUDED_ +#define JEEPS_GPSREAD_H_INCLUDED_ #include "jeeps/gps.h" @@ -8,4 +8,4 @@ int32 GPS_Serial_Packet_Read(gpsdevh* fd, GPS_Packet* packet); bool GPS_Serial_Get_Ack(gpsdevh *fd, GPS_Packet *tra, GPS_Packet *rec); -#endif +#endif // JEEPS_GPSREAD_H_INCLUDED_ diff --git a/jeeps/gpsrqst.h b/jeeps/gpsrqst.h index ad05722d6..c97e01354 100644 --- a/jeeps/gpsrqst.h +++ b/jeeps/gpsrqst.h @@ -1,5 +1,5 @@ -#ifndef gpsrqst_h -#define gpsrqst_h +#ifndef JEEPS_GPSRQST_H_INCLUDED_ +#define JEEPS_GPSRQST_H_INCLUDED_ #include "jeeps/gps.h" @@ -8,4 +8,4 @@ int32 GPS_Rqst_Send_Position(gpsdevh* fd, double lat, double lon); -#endif +#endif // JEEPS_GPSRQST_H_INCLUDED_ diff --git a/jeeps/gpssend.h b/jeeps/gpssend.h index c478e9880..3f3b12e8d 100644 --- a/jeeps/gpssend.h +++ b/jeeps/gpssend.h @@ -1,5 +1,5 @@ -#ifndef gpssend_h -#define gpssend_h +#ifndef JEEPS_GPSSEND_H_INCLUDED_ +#define JEEPS_GPSSEND_H_INCLUDED_ #include "jeeps/gps.h" @@ -12,4 +12,4 @@ void GPS_Make_Packet(GPS_Packet* packet, US type, UC* data, uint32 n); -#endif +#endif // JEEPS_GPSSEND_H_INCLUDED_ diff --git a/jeeps/gpsserial.h b/jeeps/gpsserial.h index f5eba487d..c960234d3 100644 --- a/jeeps/gpsserial.h +++ b/jeeps/gpsserial.h @@ -1,5 +1,5 @@ -#ifndef gpsserial_h -#define gpsserial_h +#ifndef JEEPS_GPSSERIAL_H_INCLUDED_ +#define JEEPS_GPSSERIAL_H_INCLUDED_ #include "jeeps/gps.h" @@ -24,4 +24,4 @@ int32 GPS_Serial_Set_Baud_Rate(gpsdevh* fd, int br); -#endif +#endif // JEEPS_GPSSERIAL_H_INCLUDED_ diff --git a/jeeps/gpsusbcommon.h b/jeeps/gpsusbcommon.h index d17456799..22f587f1a 100644 --- a/jeeps/gpsusbcommon.h +++ b/jeeps/gpsusbcommon.h @@ -19,6 +19,9 @@ */ +#ifndef JEEPS_GPSUSBCOMMON_H_INCLUDED_ +#define JEEPS_GPSUSBCOMMON_H_INCLUDED_ + /* * The 'low level ops' are registered by the OS layer (win32, libusb, etc.) * to provide gruntwork features for the common USB layer. @@ -43,3 +46,4 @@ void gusb_list_units(); /* Provided by the OS layers */ // int gusb_init(const char *portname, gpsdev **dh); +#endif // JEEPS_GPSUSBCOMMON_H_INCLUDED_ diff --git a/jeeps/gpsusbint.h b/jeeps/gpsusbint.h index cba2bee1c..2e557d1c5 100644 --- a/jeeps/gpsusbint.h +++ b/jeeps/gpsusbint.h @@ -21,7 +21,11 @@ */ +#ifndef JEEPS_GPSUSBINT_H_INCLUDED_ +#define JEEPS_GPSUSBINT_H_INCLUDED_ + int32 GPS_Packet_Read_usb(gpsdevh* fd, GPS_Packet* packet, int eatbulk); -void GPS_Make_Packet_usb(GPS_Packet* packet, UC type, UC* data, int16 n); int32 GPS_Write_Packet_usb(gpsdevh* fd, const GPS_Packet& packet); +#endif // JEEPS_GPSUSBINT_H_INCLUDED_ + diff --git a/jeeps/jgpsutil.cc b/jeeps/gpsutil.cc similarity index 100% rename from jeeps/jgpsutil.cc rename to jeeps/gpsutil.cc diff --git a/jeeps/gpsutil.h b/jeeps/gpsutil.h index 55ec8b0ba..212742833 100644 --- a/jeeps/gpsutil.h +++ b/jeeps/gpsutil.h @@ -1,5 +1,5 @@ -#ifndef gpsutil_h -#define gpsutil_h +#ifndef JEEPS_GPSUTIL_H_INCLUDED_ +#define JEEPS_GPSUTIL_H_INCLUDED_ #include "jeeps/gps.h" @@ -37,4 +37,4 @@ void GPS_Disable_Diagnose(); -#endif +#endif // JEEPS_GPSUTIL_H_INCLUDED_ -- 2.30.2